@import '../variables/default.scss';
@import '../mixins/index.scss';

$divider-prefix-cls: '.at-divider';

#{$divider-prefix-cls} {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  color: $at-divider-content-color;
  font-size: $at-divider-font-size;
  line-height: 1.5;
  list-style: none;
  background: $at-divider-line-color;

  &,
  &-vertical {
    position: relative;
    top: -0.06em;
    display: inline-block;
    width: 2px;
    height: 0.9em;
    margin: 0 8px;
    vertical-align: middle;
  }

  &-horizontal {
    display: block;
    clear: both;
    width: 100%;
    min-width: 100%; // Fix https://github.com/ant-design/ant-design/issues/10914
    height: 2px;
    margin: 24px 0;
  }

  &-horizontal#{$divider-prefix-cls}-with-text-center,
  &-horizontal#{$divider-prefix-cls}-with-text-left,
  &-horizontal#{$divider-prefix-cls}-with-text-right {
    display: table;
    margin: 16px 0;
    color: $at-divider-content-color;
    font-weight: 500;
    font-size: $at-divider-font-size;
    white-space: nowrap;
    text-align: center;
    background: transparent;

    &::before,
    &::after {
      position: relative;
      top: 50%;
      display: table-cell;
      width: 50%;
      border-top: 2px solid $at-divider-line-color;
      transform: translateY(50%);
      content: '';
    }
  }

  &-horizontal#{$divider-prefix-cls}-with-text-left,
  &-horizontal#{$divider-prefix-cls}-with-text-right {
    #{$divider-prefix-cls}-inner-text {
      display: inline-block;
      padding: 0 10px;
    }
  }

  &-horizontal#{$divider-prefix-cls}-with-text-left {
    &::before {
      top: 50%;
      width: 5%;
    }

    &::after {
      top: 50%;
      width: 95%;
    }
  }

  &-horizontal#{$divider-prefix-cls}-with-text-right {
    &::before {
      top: 50%;
      width: 95%;
    }

    &::after {
      top: 50%;
      width: 5%;
    }
  }

  &-inner-text {
    display: inline-block;
    padding: 0 24px;
  }

  &-no-space {
    white-space: nowrap;
  }

  &-dashed {
    background: none;
    border-color: $at-divider-line-color;
    border-style: dashed;
    border-width: 2px 0 0;
  }

  &-horizontal#{$divider-prefix-cls}-with-text-center#{$divider-prefix-cls}-dashed,
  &-horizontal#{$divider-prefix-cls}-with-text-left#{$divider-prefix-cls}-dashed,
  &-horizontal#{$divider-prefix-cls}-with-text-right#{$divider-prefix-cls}-dashed {
    border-top: 0;

    &::before,
    &::after {
      border-style: dashed none none;
    }
  }

  &-vertical#{$divider-prefix-cls}-dashed {
    border-width: 0 0 0 2px;
  }
}
